import sys
import subprocess
import time
import runNQueens
from statlib import stats

def run_process(command, out):
   c_command = command + " > " + out
   p = subprocess.Popen(c_command, shell=True, stdout=subprocess.PIPE)
   p.wait()

if __name__ == "__main__":

   command = "python experimentTSP.py"

   max_generation = "5000"
   mutation_probability = "0.03"
   xover_probability = "0.3"
   tryouts = "100"
   population = "50"

   args =  "mut " + max_generation + " " + mutation_probability + " " + xover_probability + " " + tryouts + " " + population
   print "Mutation exp", args
   complete_command = command + " " + args
   run_process(complete_command, args+".txt")


   args =  "xover " + max_generation + " " + mutation_probability + " " + xover_probability + " " + tryouts + " " + population
   print "xover exp", args
   complete_command = command + " " + args
   run_process(complete_command, args+".txt")

